<?php
namespace app\common\validate;

use think\Validate;

class NewsValidate extends Validate
{
    protected $rule =   [
        'title'  => 'require|max:50',
        'content' => 'require',
        'start_time' => 'require',
        'end_time' => 'require',
		'description' => 'require|max:1000',
		'class_ids' => 'require',
		'sort'	=> 'require|number'
    ];
    
    protected $message  =   [
        'title.require' => '通知标题必须填写',
        'title.max'     => '通知标题最多不能超过50个字符',
        'content.require'=> '内容必须填写',
		'description.require'=> '摘要必须填写',
		'description.max'  => '摘要最多不能超过1000个字符',
		'class_ids.require'=> '图片必须填写',
		'sort.number' => '必须输入数字',
    ];
    
    protected $scene = [
        'add'  =>  ['title','content','start_time','end_time','description','sort'],
        'edit'  => ['title','content','start_time','end_time','description','sort'],
		'sort' => ['sort']
    ];
}
